-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test with Julienne #169
base: main
Are you sure you want to change the base?
Test with Julienne #169
Conversation
189c949
to
886233a
Compare
Test coverage: * prif_init * prif_allocate, prif_deallocate, prif_allocate_coarray, prif_deallocate_coarray * prif_co_broadcast, prif_co_max, prif_co_min, prif_co_sum, prif_co_reduce * prif_image_index, prif_num_images, prif_this_image_no_coarray * prif_put, prif_get * prif_sync_all * prif_team_type, prif_form_team, prif_change_team, prif_end_team
This commit replaces veggies and iso_varying_string in the fpm manifest with julienne and assert.
git mv main.{f,F}90
This commit fixes a problem that caused seg faults when running subsets of tests. Previously, if the subset didn't include the prif_init test, then prif_init was never called. This commit calls prif_init in test/main.F90 before running the tests. Consequently, the test for normal execution of prif_init now happens via an assertion rather than in a unit test.
As suggested in the following comment, this commit defines a separate project for testing program termination: #133 (comment)
This commit removes code that was temporarily inserted when diagnosing a flang bug and uncomments the correct code.
886233a
to
435d148
Compare
This commit defines a new prif_test_t type that extends Julienne's test_t type in ordero to override test_t's "report" type-bound procedure in order to replace parallel Fortran featuers with PRIF calls.
This eliminates a do loop in prif_test_t's "report" tybe-bound procedure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't reviewed the changes the tests yet, but I have a few higher level comments so far.
- You need to add an
fpm.toml
file in thetest-termination
folder. At present the instructions in thetest-termination/README.md
do not work. Thefpm.toml
I created is listed below. - It is unclear from the output whether the tests pass or fail. I would recommend putting together some sort of script that checks the output of each individual test rather than have users try to inspect the outputs and determine pass/fail manually. This should make getting the CI to work easier as well.
- I would have made the switch to Julienne a separate PR, as the stop tests don't really depend on the test framework and vice-versa.
- I think on balance the switch to Julienne might be the right move, but I think it's worth pointing out some of the important differences:
- You get less detailed output from running the test suite. i.e. it doesn't report how many or what values are being compared. This could make debugging failing tests (or erroneously passing tests) more difficult.
- The framework is simpler, and it is one you control.
- I think you could adapt
veggies
in a similar way as you did withjulienne
, so if you're curious to try it, I could point you at the few things you'd want/need to overload.
example fpm.toml
file
name = "test-termination"
version = "0.4.1"
license = "BSD"
author = ["Damian Rouson", "Brad Richardson", "Katherine Rasmussen", "Dan Bonachea"]
maintainer = "[email protected]"
copyright = "2021-2024 UC Regents"
[dependencies]
caffeine = {path = ".."}
[build]
link = ["gasnet-smp-seq", "gcc", "m"]
The new text at the bottom of the test-termination/README.md specifies the environment variable definitions used in running the termination tests.
@everythingfunctional thanks for the quick review!
Good catch. I just pushed my
That's the plan. I'm hoping @ktras can work on this.
I agree. If we decide against the switch to Julienne, I'll create a separate PR to replace the old program termination tests with the new ones.
This morning's release of Julienne 1.6.0 adds this information in diagnostic output. This issue has been bugging me for a while, but it took some focused time over the break to think of how to add such diagnostic output in backwards-compatible way. Of course, there aren't many projects using Julienne yet (two-ish) but it would be nice to not have to rewrite multiple projects' test suites all at once. Fortunately I finally figured out a backwards-compatible path and that's in Julienne 1.6.0.
Very cool. It would probably be useful info for learning purposes either way so pointers are welcome. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some initial observations based on a quick skim of the high-level changes.
I have not yet dived into review of the test code.
test/prif_co_reduce_test_m.F90
Outdated
pure function alphabetize(lhs, rhs) result(first_alphabetically) | ||
character(len=*), intent(in) :: lhs, rhs | ||
character(len=len(lhs)) first_alphabetically | ||
call_assert(len(lhs) == len(rhs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional assertions should generally not be used in correctness tests (unless the condition being checked is expected to impose a very significant execution penalty), because then compiling in production mode (where ASSERTIONS
are off by default) will skip the assertion and undercut the coverage of the test.
call_assert(len(lhs) == len(rhs)) | |
call assert_always(len(lhs) == len(rhs), "length parameter mismatch in alphabetize") |
test/main.F90
Outdated
|
||
call stop_and_print_usage_info_if_help_requested | ||
call prif_init(stat=init_status) | ||
call_assert(init_status==successful) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
call_assert(init_status==successful) | |
call assert_always(init_status==successful, "prif_init failed") |
manifest/fpm.toml.template
Outdated
veggies = {git = "https://gitlab.com/everythingfunctional/veggies", tag = "v1.1.3"} | ||
iso_varying_string = {git = "https://gitlab.com/everythingfunctional/iso_varying_string.git", tag = "v3.0.4"} | ||
julienne = {git = "https://github.com/berkeleylab/julienne.git", tag = "1.5.3"} | ||
assert = {git = "https://github.com/berkeleylab/assert.git", tag = "2.0.0"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are adding a project dependence on berkeleylab/assert (which I DO support), then we should also excise the current caffeine_assert_s
module which was added as a temporary workaround for a lack of a real assertion library.
However this change is also orthogonal to the Julienne transition and feels like it belongs in a separate PR.
test-termination/fpm.toml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not yet convinced that the proposed change fully resolves all six of the problems outlined in issue #137 that this PR claims to solve. However it might be a step in the right direction?
This commit appends `_c_bool` to the `quiet` argument of `prif_co_reduce` and removes the `pure` attribue from the encompassing procedure.
This PR replaces PR #133 and accomplishes the following:
prif_stop
andprif_error_stop
make fragile non-portable assumptions #137 by moving the termination tests to a separatefpm
project in the newtest-termination/
subdirectory as suggested in comment r1761996357.prif_test_t
type that extends Julienne'stest_t
type and overridetest_t
'sreport
type-bound procedure, replacing parallel Fortran features with PRIF calls.The primary motivation for the switch to Julienne is complexity reduction: the Julienne software stack contains 3850 lines of code versus 30513 in Veggies as determined by executing following command on the current main branch of both repositories:
As a consequence, the test suite runs much faster even after accounting for some possible reduction in test coverage because this test suite was originally developed in 3-4 months ago so any tests added to the Veggies-based test suite since then are not represented here. Determining whether and to what extent the test coverage is actually diminished is on the To Do list below.
To Do
test-termination
subdirectory.test/
andtest-termination/
subdirectories to match the test coverage of the previous Veggies-based tests.